package client;


import shared.Stringable;
import shared.XMLRMIField;
import shared.XMLRMIMethod;
import shared.XMLRMISerializable;



public class Point implements Stringable, XMLRMISerializable{
	
	
	//FIELD DE TEST
	@XMLRMIField(serializationName="t1", serializationType="int")
	private int tt1 = 3;
	
	@XMLRMIField(serializationName="t2", serializationType="boolean")
	protected boolean tt2 = false;
	
	@XMLRMIField(serializationName="t3", serializationType="string")
	protected String tt3 = "Hello";
	
	@XMLRMIField(serializationName="t4", serializationType="double")
	protected double tt4 = 3.568;
	
	@XMLRMIField(serializationName="t5", serializationType="array")
	protected int[] tt5 = {1,2,3};
	
	@XMLRMIField(serializationName="t6", serializationType="array")
	protected float[] tt6 = {1,2,3};
	
	//FIN DES TEST
	@XMLRMIField(serializationName="a", serializationType="double")
	protected double x;
	
	@XMLRMIField(serializationName="b", serializationType="double")
	protected double y;
	
	@XMLRMIField(serializationName="marque", serializationType="string")
	protected String mark;
	
	@XMLRMIField(serializationName="test", serializationType="array")
	protected int[] test;
	
	@XMLRMIField(serializationName="test1", serializationType="array")
	protected Point2[] test2;
	
	@XMLRMIField(serializationName="test38", serializationType="array")
	protected Point2 test3;
	
	private String myCode = "1000000";
	
	@XMLRMIMethod(serializationName="toString2", serializationCode="public String toString(){return this.a + this.marque+ this.b;}")
	public String toString(){
		return ""+this.x + this.mark + this.y;
	}
	
	@XMLRMIMethod(serializationName="toJPG", serializationCode="public String toJPG(){return this.a + this.marque+ this.b+\".jpg\";}")
	public String toJPG(){
		return "JPG : "+this.x + this.mark + this.y + ".jpg";
	}
	

	@XMLRMIMethod(serializationName="add", serializationCode="public void add(int a, int b){ return a+b; }")
	public int add(int a, int b) {
		return a+b;
	}
	
	public Point(int a, int b, String marque){
		x=a;
		y=b;
		mark = marque;
		test = new int[3];
		test[0] = 0; test[1] = 0; test[2] = 0;
		
		test2 = new Point2[2];
		test2[0] = new Point2(10);
		test2[1] = new Point2(11);
		
		test3 = new Point2(9);
		
	}
}
	
